<template>
    <view class="pd pt60 pm120 bgtmert">
    	<view class="formrow">
    		<view class="z9 fz28">
    			名称
    		</view>
    		<view class="mt20 pr">
    			<input type="text" value="" placeholder="请输入名称" class="jhhgerttyt"  v-model="form.name"/>
    		</view>
    	</view>
		
		<view class="formrow mt70">
			<view class="z9 fz28">
				组织性质
			</view>
			<view class="mt20 pr jhhgerttyt">
				<picker mode="selector" :range="rangea" @change="ddffgrb">
					<view>
					<text class="z9" v-if="jhghggsd<0">
							请选择组织性质
					</text>	
					<text v-else>
						{{rangea[jhghggsd]}}
					</text>
					</view>
				</picker>
				<uni-icons type="down" color="#8F9097" class="kjnnjxeert"></uni-icons>
			</view>
		</view>
		
		<view class="formrow mt70">
			<view class="z9 fz28">
				规模
			</view>
			<view class="mt20 pr jhhgerttyt">
				<picker mode="selector" :range="rangeb" @change="ddffgrbb">
					<view>
					<text class="z9" v-if="jhghggsdb<0">
							请选择规模
					</text>	
					<text v-else>
						{{rangeb[jhghggsdb]}}
					</text>
					</view>
				</picker>
				<uni-icons type="down" color="#8F9097" class="kjnnjxeert"></uni-icons>
			</view>
		</view>
		
		
		<view class="formrow mt70">
			<view class="z9 fz28">
				地区
			</view>
			<navigator url='/pages/user/userinfo/region' class="mt20 pr jhhgerttyt">
				<!-- <text class="z9 ">请选择地区</text> -->
				<text v-if="addresss.province">
						{{addresss.province}}-{{addresss.city}}-{{addresss.area}}
				</text>	
				<text class="z9 " v-else>
					请选择地区
				</text>
				<uni-icons type="down" color="#8F9097" class="kjnnjxeert"></uni-icons>
			</navigator>
		</view>
		
		<view class="formrow mt70">
			<view class="z9 fz28">
				我的职务
			</view>
			<view class="mt20 pr">
				<input type="text" value="" placeholder="请输入我的职务" class="jhhgerttyt"  v-model="form.job_title"/>
			</view>
		</view>
    </view>
</template>
<script>
    export default {
        data() {
            return {
				jhghggsd:-1,
				rangea:[],
				jhghggsdb:-1,
				rangeb:[],
				address:[],
				configs:{},
				form:{},
				addresss:{
					province:'',
					city:'',
					area:''
				}
			}
        },
        components: {},
        methods: {
			ddffgrb(e){
				this.jhghggsd = e.detail.value
				this.form.nature =  e.detail.value
			},
			ddffgrbb(e){
				this.jhghggsdb = e.detail.value
				this.form.scale =  e.detail.value
			},
			async dengljse() {
				let configs=await this.get('/api/organization/config') // 获取组织配置信息
				this.rangea = configs.data.nature
				this.rangeb = configs.data.sacle
				
			},
			async postdata() {
				let jhsd = await this.post("/api/organization"  , this.form)
				// console.log(jhsd);
				// if(jhsd.code == 0){
					uni.navigateTo({
						url:'AddMembers'
					})
				// }
				// this.configs = creatg.data
			}
		},
		onNavigationBarButtonTap() {
			this.postdata()
			// uni.navigateBack({
			// 	delta:1
			// })
		},
		onLoad(options){
			this.dengljse()
			var that = this
			
			uni.$on('address',(params)=>{  
			        if(params.type == 1){
						this.form.province = params.id
						this.addresss.province =  params.name
					}else if(params.type == 2){
						this.form.city = params.id
						this.addresss.city =  params.name
					}else{
						this.form.area = params.id
						this.addresss.area =  params.name
					}
			    })
		},
		onUnload() {
			uni.$off('address')
		},
        mounted() {}
    }

</script>
<style  scoped>
	.kjnnjxeert{
		position: absolute;
		right: 20upx;
		top: 0upx
	}
</style>
